package org.neuedu.chapter10_0702.demo04;

import org.neuedu.chapter10_0702.demo03.Student;

import java.util.HashSet;
import java.util.Set;

public class SetDemo01 {
    public static void main(String[] args) {
        Set set = new HashSet();
        set.add("hello");
        set.add(123);
        set.add(9.9);
        set.add(true);
        set.add(new SetDemo01());
        set.add("hello");
        System.out.println(set);
        System.out.println(set.size());
        System.out.println(set.contains("hello"));

        Set<Student> sets = new HashSet<>();
        Student s1 = new Student("tom", 111, 22);
        Student s2 = new Student("lucy", 110, 22);
        Student s3 = new Student("ella", 119, 22);
        Student s4 = new Student("allen", 121, 22);
        Student s5 = new Student("mike", 123, 22);
        Student s6 = new Student("mike", 123, 22);
        sets.add(s1);
        sets.add(s2);
        sets.add(s3);
        sets.add(s4);
        sets.add(s5);
        sets.add(s6);
        System.out.println(sets);
        System.out.println(sets.size());
    }
}
